Component({
    pageLifetimes: {

        //页面展示
        show() {
        
        },
        //页面隐藏
        hide() {
        
        }
    },
  
  
    data: {
      buttons: [
        { id: 1, name: '当日',checked:true }, 
        { id: 2, name: '当月',checked:false }, 
        { id: 3, name: '当年',checked:false }
      ],
      button2: [
        { id: 1, name: '准时回款',checked:true }, 
        { id: 2, name: '应收未收',checked:false }, 
        { id: 3, name: '应收款',checked:false }, 
        { id: 4, name: '应销比',checked:false }
      ],

      tableHeader: [
        {
          prop: 'sale_name',
          width: 170,
          label: '销售单位',
          color: 'blue'
        },
        {
          prop: 'repayment_money',
          width: 135,
          label: '总回款'
        },
        {
          prop: 'ok_money',
          width: 145,
          label: '准时回款'
        },
        {
          prop: 'delay_money',
          width: 145,
          label: '逾期回款'
        },
        {
          prop: 'repayment_rate',
          width: 150,
          label: '回款准时率'
        }
      ],
      stripe: true,
      border: true,
      outBorder: true,
      row: [
        {
          "id": 1,
          "sale_name": "业务一部",
          "repayment_money": 100,
          "ok_money": 50,
          "delay_money": 800,
          "repayment_rate": 0.5,
        }, 
        
      ],
    },
    
  
    methods: {
  
      /**
       * 生命周期函数--监听页面加载
       */
      onLoad: function () {
      },
  
  
      
      /**
       * 生命周期函数--监听页面初次渲染完成
       */
      onReady:function() {
      },
        
      
      /**
       * 生命周期函数--监听页面显示
       */
      onShow:function() {
  
      },
  
      /**
       * 生命周期函数--监听页面隐藏
       */
      onHide:function() {
        
      },

      radioButtonTap2: function (e) {
        let id = e.currentTarget.dataset.id
        for (let i = 0; i < this.data.button2.length; i++) {
          if (this.data.button2[i].id == id) {
            //当前点击的位置为true即选中
            this.data.button2[i].checked = true;
          }
          else {
            //其他的位置为false
            this.data.button2[i].checked = false;
          }
        }
        this.setData({
          button2: this.data.button2,
          
        })
        
      },

      radioButtonTap: function (e) {
        console.log(e)
        let id = e.currentTarget.dataset.id
        console.log(id)
        for (let i = 0; i < this.data.row.length; i++) {
          this.data.row[i].status=id
        }
        for (let i = 0; i < this.data.buttons.length; i++) {
          if (this.data.buttons[i].id == id) {
            //当前点击的位置为true即选中
            this.data.buttons[i].checked = true;
          }
          else {
            //其他的位置为false
            this.data.buttons[i].checked = false;
          }
        }
        this.setData({
          buttons: this.data.buttons,
          
        })
        this.setData({
          row:this.data.row,
        })
        
      },



   
    },
  
      
  })

  